<!-- BEGIN:main -->

<script>

    $(function() {
        $("#datepicker").datepicker({
            changeMonth: true,
            changeYear: true
        });
    });


    function submitForm(action)
    {

        var image = $('#txtImage');
        var title = $('#txtTitle');


        var hasError = validateEmptyValue(new Array(image, title));

        if (hasError) {
            alert('Vui lòng điền đầy đủ thông tin');
        } else {
            var alias = $('#txtAlias');
            if (alias.val().trim() == '') {
                alias.val(title.val());
            }
            var form = document.phpForm;
            form.hdAction.value = action;
            form.submit();
        }

    }


    function BrowseImage() {
        var finder = new CKFinder();
        finder.BasePath = '../blugin/ckeditor3.6.4/ckfinder/';
        finder.startupPath = "Albums/albums/";
        finder.SelectFunction = SetImageField;
        finder.Popup();
    }


    function SetImageField(fileUrl) {
        document.getElementById('txtImage').value = fileUrl;
        document.getElementById('hdImage').value = fileUrl;
    }
</script>



<div id="toolbar-box">
    <div class="d_divide5"></div>
    <div class="toolbar" id="toolbar">
        <table class="toolbar">
            <tbody>
                <tr>
                    <td class="button" id="toolbar-save">
                        <a href="javascript:void()" onclick="submitForm('addAndExit')" class="toolbar">
                            <span class="icon-32-save" title="Lưu và thoát">
                            </span>
                            Lưu và thoát
                        </a>
                    </td>

                    <td class="button" id="toolbar-apply">
                        <a href="javascript:void()" onclick="submitForm('add')" class="toolbar">
                            <span class="icon-32-apply" title="Lưu">
                            </span>
                            Lưu
                        </a>
                    </td>


                    <td class="button" id="toolbar-cancel">
                        <a href=".?com=com_image&view=category&task=view" class="toolbar">
                            <span class="icon-32-cancel" title="Hủy">
                            </span>
                            Hủy
                        </a>
                    </td>



                </tr>
            </tbody>
        </table>
    </div>

    <div class="header icon_48_image_category_add">
        Album ảnh: <small><small>[ Thêm mới ]</small></small><br>
    </div>
    <div class="d_divide5"></div>

</div>

<div class="d_divide10"></div>
<div class="d_clear"></div>

<div id="element-box">


    <form method="post" name="phpForm">
        <input type="hidden" name="hdAction"/>

        <fieldset class="adminform">
            <legend>Chi tiết</legend>

            <!--left column-->
            <div style="width: 50%; float: left">

                <!--title-->
                <div>
                    <label for="txtTitle" class="d_label">Tên: <b style="color: red;">*</b></label>
                    <input style="width: 350px;" class="d_text_input" name="txtTitle" id="txtTitle" value="" size="50" maxlength="50" title="Tên nhóm sản phẩm" type="text" />
                </div>

                <div class="d_divide2"></div>

                <!--image-->
                <div>
                    <label for="btBrowseImage" class="d_label">Hình ảnh: <b style="color: red;">*</b></label>
                    <input class="d_text_input" style="background: #ffffff;width: 300px;" type="text" id="txtImage" name="txtImage" value="" disabled="disabled" size="50"/>
                    <input id="btBrowseImage" class="d_button" type="button" onClick="javascript:BrowseImage();" value="Chọn" />
                    <input type="hidden" id="hdImage" name="hdImage" value=""/>
                </div>

                <div class="d_divide2"></div>

            </div>



            <!--right column-->
            <div style="width: 50%;float: left">
                <div>
                    <label for="txtAlias" class="d_label">Alias (Định danh):</label>
                    <input style="width: 350px;" class="d_text_input" name="txtAlias" id="txtAlias" value="" size="50" maxlength="50" title="Alias sản phẩm" type="text" />
                </div>
                <div class="d_divide2"></div>
                <div>
                    <label for="datepicker" class="d_label">Ngày tạo: </label>
                    <input readonly="true" value="{TODAY}" class="d_text_input" id="datepicker" style="WIDTH: 80px; float: left; margin-right: 5px" name="createdDate" />
                    <div class="d_label">Bật/Tắt: </div>
                    <input name="rdoState" value="0" class="inputbox" type="radio"  />
                    <label >Tắt</label>
                    <input name="rdoState" value="1" checked="checked" class="inputbox" type="radio" />
                    <label >Bật</label>
                </div>
            </div>
        </fieldset>

        <fieldset class="adminform">
            <legend>Sự miêu tả</legend>


            <textarea name="txtDescription" id="txtDescription"></textarea>
            <script language="javascript" type="text/javascript">
                CKEDITOR.replace('txtDescription',
                        {
                            filebrowserBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html',
                            filebrowserImageBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html?type=Images',
                            filebrowserFlashBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html?type=Flash',
                            height: 250,
                            toolbarStartupExpanded: false
                        });
            </script>

        </fieldset>





    </form>

</div>
<noscript>
!Cảnh báo! Javascript phải được bật để chạy được các chức năng trong phần Quản trị		</noscript>

<!-- END:main -->